#ifndef YOOHOO_XMPPCORE_ABSTRACTERROR_H
#define YOOHOO_XMPPCORE_ABSTRACTERROR_H

#include "xmppcore/error.h"

#include <QtCore/QSharedDataPointer>

namespace yoohoo_xmppcore {

class XmlWriter;

class ErrorSharedData : public QSharedData {
public:
	ErrorSharedData();
	ErrorSharedData(const ErrorSharedData& other);
	~ErrorSharedData();

	XmppObject* applicationSpecificCondition;
	QString definedCondition;
	XmlLangText text;
};

class YOOHOO_XMPPCORE_EXPORT AbstractError : public Error {
public:
	AbstractError(QString definedCondition = QString(), XmlLangText text = XmlLangText());
	virtual QString definedCondition();
	virtual void setDefinedCondition(QString definedCondition);
	virtual XmlLangText text();
	virtual void setText(XmlLangText text);
	virtual XmppObject* applicationSpecificCondition();
	virtual void setApplicationSpecificCondition(XmppObject* applicationSpecificCondition);
	virtual QString toXml();

protected:
	virtual void writeErrorHeader(XmlWriter* writer) = 0;
	virtual void writeErrorFooter(XmlWriter* writer) = 0;
	virtual QString definedConditionNamespace() = 0;

	QSharedDataPointer<ErrorSharedData> _d;
};

}

#endif
